package com.example.xln111.Dao;

import com.example.xln111.model.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface StudentMapper {
    @Select("SELECT * FROM student")
    public List<Student> getAll();

    @Insert("INSERT INTO student(name,sex,Classname) VALUES(#{name}, #{sex}, #{Classname})")
    public int addStudent(Student student);

    @Update("UPDATE student SET name = #{name},sex = #{sex},Classname = #{Classname} WHERE id = #{id}")
    public int updateStudent(Student student);

    @Delete("DELETE FROM student WHERE id = #{id}")
    public int deleteStudentById(int id);

    @Select("SELECT * FROM student WHERE id = #{id}")
    public Student getStudentById(int id);
}